package com.web44.ssm.config;

import com.web44.ssm.filter.ProjectFilter;
import jakarta.servlet.Filter;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.ServletRegistration;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * @Title: ServletConfig
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2024/1/15 11:21
 */
public class ServletConfig extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{SpringConfig.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{SpringMvcConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }

    @Override
    protected Filter[] getServletFilters() {
        Filter[] filters = {new ProjectFilter()};
        return filters;
    }

    @Override
    protected void customizeRegistration(ServletRegistration.Dynamic registration) {
        registration.setMultipartConfig(new MultipartConfigElement("D:\\00.班级\\web44\\02.javaweb\\springmvcwockplace\\SpringmvcDemo\\SsmDemo01\\src\\main\\webapp\\upload"));
    }
}
